package operations;

import javax.swing.text.BadLocationException;
import java.util.regex.PatternSyntaxException;
import javax.swing.JTextArea;


public class FindAllStrtagy extends BaseClass implements FindInterface{
		
	public void AddHighlights(JTextArea text) throws BadLocationException, PatternSyntaxException{
		DefineHighlighter(text);
		while(SearcheWordSteream.find()){	
			try {
					highlighter.addHighlight(SearcheWordSteream.start(), SearcheWordSteream.end(), PainterAll);
					
				} catch (PatternSyntaxException e) {
			
					e.printStackTrace();
				}
			    }		 
	}
	public void FindPattern(JTextArea text, String SearchedWord){
		RemoveHighlights(text);
	    Stream=text.getText();
	    DefinePattern(text,SearchedWord);
	    try {
			AddHighlights(text);
		} catch (PatternSyntaxException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (BadLocationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}	    
	}	
}
